#ifndef _RATIONAL_H
#define _RATIONAL_H

int gcd(int a, int b);


struct Rational {
	Rational(const int numerator, const int denominator = 1); 
	Rational(const Rational& r);

	Rational& operator= (const Rational& r); 
	Rational& operator+= (const Rational& r); 
	Rational& operator-= (const Rational& r); 
	Rational& operator*= (const Rational& r); 
	Rational& operator/= (const Rational& r); 
	Rational& operator++();
	Rational operator++(int);
	Rational& operator--();
	Rational operator--(int);

	int numerator() const { return _numerator; }
	int denominator() const { return _numerator; }

	operator double ();
	Rational& simplify();

private:
	int _numerator;
	int _denominator;
};

Rational operator+ (const Rational& a, const Rational& b);
Rational operator- (const Rational& a, const Rational& b);
Rational operator* (const Rational& a, const Rational& b);
Rational operator/ (const Rational& a, const Rational& b);

bool operator== (const Rational& a, const Rational& b);
bool operator!= (const Rational& a, const Rational& b);
bool operator<= (const Rational& a, const Rational& b);
bool operator>= (const Rational& a, const Rational& b);
bool operator<  (const Rational& a, const Rational& b);
bool operator>  (const Rational& a, const Rational& b);




#endif //#ifndef _RATIONAL_H
